!!$            
!!$ The program reads a xtc file using the fxtc library. A pdb file need  
!!$ to be provided.
!!$ 
!!$ Use F_openfile to open the pdb and the xtc files. The pdb must contains all atoms 
!!$ of the system.
!!$ 
!!$ Use F_readlabels to read the atomic labels and place them in the character array labs
!!$
!!$ Use F_readnext to read the co matrix (the box vector coordinates) and the coordinates 
!!$ of all the atoms of the system. F_readnext is a function returning the step number  
!!$ which has been read. This function has an optional argument; when this is .true. 
!!$ the step is skipped and no coordinates are transferred; when .false. the coordinates
!!$ are read normally.
!!$
!!$ The program includes a file which contains the interface for each the above mentioned 
!!$ routines.
!!$
!!$
program test
    implicit none
    include 'interface.f90'
    character(len=140) :: pdb,xtc
    integer :: n,step,o
    real(4), allocatable :: x(:),y(:),z(:),co(:) !!$ Need to be declared
    character(len=4), allocatable :: labs(:)     !!$ allocatable!!
    READ(5,*) pdb,xtc !!$ name of the .pdb and .xtc files. The name length 
                      !!$ must not exceed 140 characters
    call F_openfiles(pdb,xtc,n)

    allocate (x(n),y(n),z(n),labs(n),co(9))

    call F_readlabels(labs)
!!$
!!$ Skip 5 steps
!!$
    do o=1,5
        step=F_readnext(co,x,y,z,.true.)
        if(step .lt. 0) exit
    enddo
!!$
!!$ Read 96 steps. 
!!$
    do
        step=F_readnext(co,x,y,z)
        if(step .lt. 0 .or. step .eq. 100) exit !!$ If step < 0 program stops !!
        write(*,*) x(10),y(10),z(10)
    enddo

    write(*,*) " Program exited !!"
end program test
